//
//  HWControl.m
//  Movie
//
//  Created by tengyang on 15/7/17.
//  Copyright (c) 2015年 tengyang. All rights reserved.
//

#import "HWControl.h"

@implementation HWControl

- (id)initWithFrame:(CGRect)frame withImageName:(NSString *)imageName withTitle:(NSString *)title
{
    self=[super initWithFrame:frame];
    if (self) {
        _imageView=[[UIImageView alloc]initWithFrame:CGRectZero];
        _imageView.image=[UIImage imageNamed:imageName];
        _imageView.contentMode=UIViewContentModeScaleAspectFit;
        [self addSubview:_imageView];
        
        _lable=[[UILabel alloc]initWithFrame:CGRectZero];
        _lable.text=title;
        _lable.textAlignment=NSTextAlignmentCenter;
        _lable.font=[UIFont systemFontOfSize:11];
        _lable.textColor=[UIColor whiteColor];
        [self addSubview:_lable];
    }
    return self;
}

- (void)layoutSubviews
{
    //CGFloat width=
    [super layoutSubviews];
    _imageView.frame=CGRectMake((self.frame.size.width-20)/2, 5, 20, 20);
    _lable.frame=CGRectMake(0, 25, CGRectGetWidth(self.frame), 20);
    
    
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
